<?php
error_reporting(0);
header("Content-Type: text/plain");

$callback = $_REQUEST['callback'];
$statusCode = validateurl($_REQUEST['url']);

if(!empty($callback))
  echo $callback."(";

if ($statusCode=='200')
  echo '{return:1}';
else
  echo '{return:0}';

if(!empty($callback))
  echo ")";

function validateurl($url){
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_NOBODY, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $data = curl_exec($ch);
  curl_close($ch);
  preg_match("/HTTP\/1\.[1|0]\s(\d{3})/",$data,$matches);
  return $matches[1];
}

?>